//
//  PicsViewController.m
//  Auditory
//
//  Created by 寒竹子 on 15/4/28.
//  Copyright (c) 2015年 寒竹子. All rights reserved.
//  图集页面

#define BAR_H 30.0f

#import "PicsViewController.h"
#import "XiaoHuaViewController.h"
#import "QingChunViewController.h"
#import "KeAiViewController.h"
#import "NetGirlViewController.h"
#import "XRSegmentNavigation.h"
#import "XiaoQingXinlViewController.h"
#import "ChangTuiViewController.h"
#import "QiZhiViewController.h"
#import "CheMoViewController.h"
#import "TSCViewController.h"
#import "ShingShangViewController.h"

@interface PicsViewController ()

@property (nonatomic, strong) XRSegmentNavigation * segmentNav;
@property (nonatomic, strong) NSMutableArray * viewControllers;

@end

@implementation PicsViewController

- (instancetype)init
{
    if (self = [super init]) {
        _viewControllers = [[NSMutableArray alloc] init];
    }
    
    return self;
}

- (void)setupUI
{
    self.view.backgroundColor = [UIColor whiteColor];
    
    // 创建视图
    XiaoHuaViewController * xiaoHuaVc = [[XiaoHuaViewController alloc] init];
    QingChunViewController * qingChunVc = [[QingChunViewController alloc] init];
    KeAiViewController * keAiVc = [[KeAiViewController alloc] init];
    NetGirlViewController * netGirlVc = [[NetGirlViewController alloc] init];
    XiaoQingXinlViewController * xqxVc = [[XiaoQingXinlViewController alloc] init];
    ChangTuiViewController * ctVc = [[ChangTuiViewController alloc] init];
    QiZhiViewController * qiZhiVc = [[QiZhiViewController alloc] init];
    CheMoViewController * cheMoVc = [[CheMoViewController alloc] init];
    TSCViewController * tscVc = [[TSCViewController alloc] init];
    ShingShangViewController * shingshangVc = [[ShingShangViewController alloc] init];
    
    [_viewControllers addObject:xiaoHuaVc];
    [_viewControllers addObject:qingChunVc];
    [_viewControllers addObject:keAiVc];
    [_viewControllers addObject:netGirlVc];
    [_viewControllers addObject:xqxVc];
    [_viewControllers addObject:ctVc];
    [_viewControllers addObject:qiZhiVc];
    [_viewControllers addObject:cheMoVc];
    [_viewControllers addObject:tscVc];
    [_viewControllers addObject:shingshangVc];
    
    // 创建XRSegmentNavigation
    _segmentNav = [[XRSegmentNavigation alloc] initWithViewControllers:_viewControllers titles:@[@"校花", @"清纯", @"可爱", @"网络美女", @"小清新", @"长腿", @"气质", @"车模", @"甜素纯", @"时尚"] callBlock:^(NSInteger index) {
        
    }];
    
    _segmentNav.textFont = TextFont(15.0f);
    _segmentNav.normalColor = RGB(100, 100, 100, 1.0f);
    _segmentNav.selectedColor = RGB(10, 10, 10, 1.0f);
    _segmentNav.barHeight = BAR_H+5;
    _segmentNav.backgroundColor = [UIColor whiteColor];
    _segmentNav.image = [UIImage imageNamed:@"line"];
    _segmentNav.defaultIndex = 0;
    
    [self.view addSubview:_segmentNav.view];
    
    // 传入导航
    ((XiaoHuaViewController *)_viewControllers[0]).rootNav = self.rootNav;
    ((QingChunViewController *)_viewControllers[1]).rootNav = self.rootNav;
    ((KeAiViewController *)_viewControllers[2]).rootNav = self.rootNav;
    ((NetGirlViewController *)_viewControllers[3]).rootNav = self.rootNav;
    ((XiaoQingXinlViewController *)_viewControllers[4]).rootNav = self.rootNav;
    ((ChangTuiViewController *)_viewControllers[5]).rootNav = self.rootNav;
    ((QiZhiViewController *)_viewControllers[6]).rootNav = self.rootNav;
    ((CheMoViewController *)_viewControllers[7]).rootNav = self.rootNav;
    ((TSCViewController *)_viewControllers[8]).rootNav = self.rootNav;
    ((ShingShangViewController *)_viewControllers[9]).rootNav = self.rootNav;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setupUI];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
